#ifndef _MAP_H
#define _MAP_H

#include "MapPoint.hpp"

#include <mutex>
#include "Marker.h"
#include "keyframe.h"

namespace markerAR
{
    

class Map
{
public:
    
    inline Marker** getMarkerPointer(int idx)
    {
        std::lock_guard<std::mutex> lock(mutex_marker);
        return &allMarkers[idx];
    }
    
    inline Marker* getMarker(int idx)
    {
        std::lock_guard<std::mutex> lock(mutex_marker);
        return allMarkers[idx];
    }
    inline Keyframe* getKeyFrame(int idx)
    {
        std::lock_guard<std::mutex> lock(mutex_keyframe);
        return allKeyFrames[idx];
    }
    
    inline void addMarker(Marker* m)
    {
        std::lock_guard<std::mutex> lock(mutex_marker);
        allMarkers.push_back(m);
    }
    
    inline void addKeyFrame(Keyframe* k)
    {
        std::lock_guard<std::mutex> lock(mutex_keyframe);
        allKeyFrames.push_back(k);
    }
    
    inline size_t getKeyFrameSize()
    {
        std::lock_guard<std::mutex> lock(mutex_keyframe);
        return allKeyFrames.size();
    }
    
    inline size_t getMarkerSize()
    {
        std::lock_guard<std::mutex> lock(mutex_keyframe);
        return allMarkers.size();
    }
    
    
private:
    std::vector<Marker*> allMarkers;
    std::vector<Keyframe*> allKeyFrames;
    std::mutex mutex_keyframe,mutex_marker;
};



}








#endif